﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HTML5.WebWoker
{
    public partial class Server : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string tag = Request["tag"]??string.Empty;
            if (tag == "getDataByWorker1")
            {
                string res = "[";
                for (int i = 1; i < 11; i++)
                {
                    res += "{";
                    res += "id:'work1_" + i + "',name:'work1_name_" + i + "',birthday:'work1_birthday_" + i + "',address:'work1_address_:" + i + "'";
                    res += "},";
                }
                res = res.Substring(0, res.LastIndexOf(','));
                res += "]";

                Response.Write(res);
            }
            if (tag == "getDataByAjax")
            {
                string res = "[";
                for (int i = 1; i < 11; i++)
                {
                    res += "{";
                    res += "id:'ajax_id_" + i + "',name:'ajax_name_" + i + "',birthday:'ajax_birthday_" + i + "',address:'ajax_address_:" + i + "'";
                    res += "},";
                }
                res = res.Substring(0, res.LastIndexOf(','));
                res += "]";

                Response.Write(res);
            }
            if (tag == "getDataByWorker3")
            {
                string res = "[";
                for (int i = 1; i < 11; i++)
                {
                    res += "{";
                    res += "id:'work3_" + i + "',name:'work3_name_" + i + "',birthday:'work3_birthday_" + i + "',address:'work3_address_:" + i + "'";
                    res += "},";
                }
                res = res.Substring(0, res.LastIndexOf(','));
                res += "]";

                Response.Write(res);
            }
        }
    }

    public class Person 
    {
        public string id { get; set; }
        public string name { get; set; }
        public string age { get; set; }
    }
}